package com.startsola;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class Main {

    public static String[] urls = {
        "http://wx.e5421.com/phpWeChat/index.php?m=book&a=ajax_one_date_doc_list&date=2019-06-15",
        "http://wx.e5421.com/phpWeChat/index.php?m=book&a=ajax_one_date_doc_list&date=2019-06-16",
    };

    public static void main(String[] args) throws Exception{
        List<String> cookies = Arrays.asList(args);

        System.out.println("cookie:" + cookies);

        int num = 0;
        int resetSize = urls.length * cookies.size();
        while (true) {

            Thread.sleep(3 * 1000);

            String cookie = cookies.get(num % cookies.size());// 获取 cookie
            String url = urls[(num / cookies.size()) % urls.length]; // 获取 URL

            String content = HttpClientService.sendGet(url + "&time=" + new Date().getTime(), null, cookie);;

            String pattern = "有号";

            int i = content.indexOf(pattern);

            if (i != -1) {
                Roboot.send("xxx", true);
            } else {
                num %= (resetSize * 8);
                if (num == 0) {
                    Roboot.send(content.substring(content.length() - 300, content.length()), false);
                }
            }
            num ++;
        }
    }



    //播放方法
    public static void play() {


    }
}
